<html>
<head><meta charset="utf-8"><title>moving the leak check to evaluation · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html">moving the leak check to evaluation</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="197599651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/197599651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#197599651">(May 14 2020 at 18:40)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> -- so I've been thinking about the continuing push to move away from the leak check and towards universes. In particular, I'm mulling a change that moves <em>where</em> the leak check occurs, in an effort to unblock lazy normalization and a few other things. Here is a "proto MCP" that is writing up the idea:</p>
<p><a href="https://hackmd.io/O2O1lfxsT7e9GL9nMEeT5Q?edit">https://hackmd.io/O2O1lfxsT7e9GL9nMEeT5Q?edit</a></p>
<p>I'm curious to get your thoughts. Sorry if that's unclear, it was hastily written.</p>



<a name="197599683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/197599683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#197599683">(May 14 2020 at 18:41)</a>:</h4>
<p>I had at first a slightly different plan but realized a complication as I was writing out the MCP...</p>



<a name="197611368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/197611368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#197611368">(May 14 2020 at 20:12)</a>:</h4>
<p>I think I need more detail before I can really comment. I'm not entirely sure how the leak check is interacting with lazy normalization.</p>



<a name="198179400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198179400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198179400">(May 20 2020 at 10:32)</a>:</h4>
<p>OK, I've been pushing on this a bit more. I have to update the MCP document, but I've pushed a rough prototype (one test still failing and I haven't tracked it down) to the <a href="https://github.com/nikomatsakis/rust/tree/move-leak-check">move-leak-check branch</a>. The <a href="https://github.com/nikomatsakis/rust/commit/fac84bd11f7165e2fe8ca08bc46a6ff244587fb9">final commit</a> has a length comment that tries to explain the motivation and design. (The earlier commits rewrite the leak-check to be somewhat more precise and more based on universes.)</p>



<a name="198179472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198179472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198179472">(May 20 2020 at 10:33)</a>:</h4>
<p>Side note that <span class="user-mention" data-user-id="116113">@lqd</span> this commit explains a bit how I think the trait solver and polonius ought to interact.</p>



<a name="198198862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198198862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198198862">(May 20 2020 at 13:35)</a>:</h4>
<p>ooh awesome :)</p>



<a name="198201777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198201777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198201777">(May 20 2020 at 13:57)</a>:</h4>
<p>and sounds very logical (although I'm not super aware of the leak check's many interactions <span aria-label="octopus" class="emoji emoji-1f419" role="img" title="octopus">:octopus:</span>) -- maybe when interacting with the trait solver, we'd like to break up the polonius computation more, if interactively targeting some of its pieces are more interesting than the others. (Maybe even incrementally)</p>



<a name="198202798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198202798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198202798">(May 20 2020 at 14:04)</a>:</h4>
<p>The main thing is that I think the trait solver should manage "higher-ranked" things, and send polonius only simple subset relations</p>



<a name="198202946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198202946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198202946">(May 20 2020 at 14:05)</a>:</h4>
<p>There are a few reasons for this -- part of is it that the datalog setup I think just isn't a good match for solving higher-ranked constraints and universes -- but it's also that figuring out what sort of <code>'a: 'b</code> bounds are implied by types being well-formed and so forth is the kind of thing chalk already has to figure out, to manage implied bounds, and that's going to be a necessary part of this.</p>



<a name="198203008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198203008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198203008">(May 20 2020 at 14:05)</a>:</h4>
<p>And I don't want to have e.g. polonius having to ask questions about whether a trait is implemented :)</p>



<a name="198203165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198203165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198203165">(May 20 2020 at 14:06)</a>:</h4>
<p>As I wrote in the comment above, the leak-check doesn't <em>quite</em> do this, but it goes part-way there, in that the trait solver is at least <em>rejecting</em> errors early rather than deferring to the region solver.</p>



<a name="198203228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198203228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198203228">(May 20 2020 at 14:06)</a>:</h4>
<p>One downside of this approach though is that it's more visible, so it gives us less room to change the rules and get smarter without affecting method dispatch and the like :(</p>



<a name="198203277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198203277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198203277">(May 20 2020 at 14:06)</a>:</h4>
<p>(yeah I was earlier mentioning to shep that chalk needed those same building blocks regardless)</p>



<a name="198203438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198203438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198203438">(May 20 2020 at 14:07)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation/near/198203228">said</a>:</p>
<blockquote>
<p>One downside of this approach though is that it's more visible, so it gives us less room to change the rules and get smarter without affecting method dispatch and the like :(</p>
</blockquote>
<p>But I think this is kind of inevitable, since there are crates that are relying on this.</p>



<a name="198203451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198203451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198203451">(May 20 2020 at 14:08)</a>:</h4>
<p>e.g., wasm-bindgen</p>



<a name="198203891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198203891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198203891">(May 20 2020 at 14:11)</a>:</h4>
<p>it's also just kind of a useful capability</p>



<a name="198203895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198203895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198203895">(May 20 2020 at 14:11)</a>:</h4>
<p>to be able to rely on :)</p>



<a name="198203914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198203914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198203914">(May 20 2020 at 14:11)</a>:</h4>
<p>i.e, the wasm-bindgen use-case is legit</p>



<a name="198203952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198203952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198203952">(May 20 2020 at 14:11)</a>:</h4>
<p>wanting to have one implementation for "I take ownership of this" and one for "I borrow this"</p>



<a name="198204004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198204004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198204004">(May 20 2020 at 14:11)</a>:</h4>
<p>unfortunate :)</p>



<a name="198204013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198204013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198204013">(May 20 2020 at 14:11)</a>:</h4>
<p>not to mention the fact that crates rely on all kinds of weird details of our type check that we have to fix sometimes</p>



<a name="198204088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198204088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198204088">(May 20 2020 at 14:12)</a>:</h4>
<p>so..yeah. life in production :)</p>



<a name="198204093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198204093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198204093">(May 20 2020 at 14:12)</a>:</h4>
<p>but yeah, we don't have much of a choice</p>



<a name="198204174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198204174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198204174">(May 20 2020 at 14:12)</a>:</h4>
<p>(that being said, I'm less and less enamored with datalog (to execute the analysis rather than describing it and having a "reference implementation") so wouldn't oppose doing non-datalog work in there, and I think that we might <em>have to</em> anyway)</p>



<a name="198206373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198206373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198206373">(May 20 2020 at 14:28)</a>:</h4>
<p>yeah, maybe so, but regardless I think it's better to separate out the two</p>



<a name="198206382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198206382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198206382">(May 20 2020 at 14:28)</a>:</h4>
<p>if we can</p>



<a name="198206447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198206447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198206447">(May 20 2020 at 14:28)</a>:</h4>
<p>oh sure :)</p>



<a name="198207939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198207939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198207939">(May 20 2020 at 14:39)</a>:</h4>
<p>ok, I pushed a new commit and all tests pass, though I still want to fix the commit marked as "WIP" and add a few more tests</p>



<a name="198207954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198207954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198207954">(May 20 2020 at 14:39)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> btw :)</p>



<a name="198207980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198207980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198207980">(May 20 2020 at 14:39)</a>:</h4>
<p>and I have to update the MCP, I think it's very much worth investing the time to write out the implications</p>



<a name="198207986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198207986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198207986">(May 20 2020 at 14:39)</a>:</h4>
<p>for future reference</p>



<a name="198429224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198429224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198429224">(May 22 2020 at 11:06)</a>:</h4>
<p>Started drafting a <a href="https://github.com/nikomatsakis/rust/blob/move-leak-check/mcp.md">complete MCP</a> for this proposal that includes a lot of background on the leak-check (cc <span class="user-mention" data-user-id="232957">@Jack Huey</span>, since you've often expressed confusion here). It's not complete yet and it's already quite long, but hopefully helpful.</p>



<a name="198429250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198429250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198429250">(May 22 2020 at 11:07)</a>:</h4>
<p>It also describes the interaction with lazy normalization, <span class="user-mention" data-user-id="116118">@Matthew Jasper</span>.</p>



<a name="198441242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198441242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198441242">(May 22 2020 at 13:32)</a>:</h4>
<p>OK, I've completed this rather epic treatise =) I put it in a <a href="https://gist.github.com/nikomatsakis/8bfda6c1119727e13ec6e98f33d2b696">gist</a></p>



<a name="198464156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198464156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198464156">(May 22 2020 at 16:39)</a>:</h4>
<p>This is helpful. I've quickly skimmed through, but kind of want to go through more thoroughly when I have time</p>



<a name="198470487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198470487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198470487">(May 22 2020 at 17:30)</a>:</h4>
<p>I'm making a few more tweaks in the branch / text</p>



<a name="198470502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198470502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198470502">(May 22 2020 at 17:31)</a>:</h4>
<p>I noticed that we are doing leak-check in more places than I realized</p>



<a name="198470514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198470514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198470514">(May 22 2020 at 17:31)</a>:</h4>
<p>so i'm removing those to see what happens</p>



<a name="198470531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198470531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198470531">(May 22 2020 at 17:31)</a>:</h4>
<p>I believe we should be able to limit ourselves to a few key places</p>



<a name="198471518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198471518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198471518">(May 22 2020 at 17:38)</a>:</h4>
<p>Thanks for the mcp. It has made things a lot clearer.</p>



<a name="198473080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198473080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198473080">(May 22 2020 at 17:51)</a>:</h4>
<p>I'm investigating removing all the leak-checks <em>except</em> the ones on coherence and evaluation</p>



<a name="198473132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198473132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198473132">(May 22 2020 at 17:52)</a>:</h4>
<p>which I think would be best</p>



<a name="198473238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198473238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198473238">(May 22 2020 at 17:53)</a>:</h4>
<p>I did realize a bit how this can influence execution -- in particular, if there is only 1 candidate for a trait, we will pick it now, even if the leak check would've failed. (If there are multiple candidates, we'll use the leak check to sort through them.)</p>
<p>In our tests, this mostly results in better error messages, but you can imagine it impacting some code. It would have to be a tricky setup though -- one where some trait applies with 0 derefs (or whatever), but will fail leak-check, and then some other method applies with &gt;0 derefs, but would pass leak-check.</p>



<a name="198473282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198473282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198473282">(May 22 2020 at 17:53)</a>:</h4>
<p>I'm not sure if that's really true actually because I believe method dispatch uses the <code>evaluate</code> machinery anyway.</p>



<a name="198473383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198473383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198473383">(May 22 2020 at 17:54)</a>:</h4>
<p>(The better error messages happen because we trigger special paths for placeholder errors, instead of failing to apply the impl at all and then getting an error about there not being an applicable impl.)</p>



<a name="198474365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198474365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198474365">(May 22 2020 at 18:02)</a>:</h4>
<p>I'm inclined to agree that restricting the leak check as much as possible would be good. It appears that it is already not applied to all bounds.</p>



<a name="198474501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198474501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198474501">(May 22 2020 at 18:03)</a>:</h4>
<p>Yeah it's sort of uneven</p>



<a name="198475583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198475583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198475583">(May 22 2020 at 18:14)</a>:</h4>
<p>hmm, removing some of the leak-checks from project results in duplicate errors</p>



<a name="198475627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198475627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198475627">(May 22 2020 at 18:14)</a>:</h4>
<p>which is sort of annoying</p>



<a name="198475640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198475640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198475640">(May 22 2020 at 18:14)</a>:</h4>
<p>though maybe easy enough to suppress</p>



<a name="198476429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/moving%20the%20leak%20check%20to%20evaluation/near/198476429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/moving.20the.20leak.20check.20to.20evaluation.html#198476429">(May 22 2020 at 18:20)</a>:</h4>
<p>anyway, apart from that, the only other thing is that I realized my leak-check impl isn't actually correct right now (doesn't <em>quite</em> match what the MCP says) but it's easy enough to fix, just been lazy</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>